package stack;

public class TestStack {

    public static void main(String[] args) {

        MyStack arr = new MyStack();

        arr.buildstack();                           //建栈 初始化

        int i = 0;
        while (i != 6) {
                i= arr.controller();                //控制台
            switch (i) {
                case 1:
                    arr.pushstack();                //入栈操作
                    break;
                case 2:
                    arr.gettop();                   //取栈顶元素
                    break;
                case 3:
                    arr.stackempty();               //判断栈是否为空
                    break;
                case 4:
                    arr.popstack();                 //出栈操作
                    break;
                case 5:
                    arr.search();                   //查找栈内元素
                    break;
                case 6:
                    break;
                default:
                    System.out.println("Wrong input");
                    break;
            }
        }
     }
    }
